package org.pp.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Map;

import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 订单条目表
 * </p>
 *
 * @author haima
 * @since 2024-10-07
 */
@Getter
@Setter
@TableName(value = "pp_order_item",autoResultMap = true)
@Schema(name = "PpOrderItem", description = "订单条目表")
public class PpOrderItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "订单条目Id")
    @TableId(value = "order_item_id", type = IdType.AUTO)
    private Long orderItemId;

    @Schema(description = "商品id")
    private Long goodsId;

    @Schema(description = "sku的id")
    private Long skuId;

    @Schema(description = "订单id")
    private Long orderId;

    @Schema(description = "商品名称")
    private String name;

    @Schema(description = "sku封面图")
    private String cover;

    @Schema(description = "原价")
    private BigDecimal originPrice;

    @Schema(description = "售价")
    private BigDecimal price;

    @Schema(description = "选择的属性值拼接")
    @TableField(exist = false)
    private String attrInfoStr;

    @Schema(description = "选择的属性值")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String,String> attrInfo;

    @Schema(description = "购买数量")
    private Integer amount;

    @Schema(description = "商品总价（售价乘以数量，感觉冗余)")
    private BigDecimal totallPrice;

    @Schema(description = "邮费")
    private BigDecimal totallPostage;

    @Schema(description = "邮费说明")
    private String totallPostageDesc;

    @Schema(description = "单件运费")
    private BigDecimal postage;

    @Schema(description = "发货地")
    private String postFrom;

    @Schema(description = "是否免运费")
    private Boolean postageIfFree;

    @Schema(description = "是否服从系统满免运费规则")
    private Boolean postageInRuleIfFree;

    @Schema(description = "相同sku邮费是否合并")
    private Boolean postageSkuIfMerge;

    @Schema(description = "满减规则的，瞬间阈值")
    private BigDecimal postageThreshold;

    @Schema(description = "租户号")
    private Long tenantId;

    @Schema(description = "乐观锁")
    private Integer revision;

    @Schema(description = "创建时间")
    private LocalDateTime createdTime;

    @Schema(description = "更新时间")
    private LocalDateTime updatedTime;

    @Schema(description = "逻辑删除 1为删除 0为正常")
    private Boolean deleted;
}
